package com.sbmoon.db;

import java.util.ResourceBundle;

import com.sbmoon.*;
import com.sbmoon.util.BundleUtil;

public class DbFactory extends ComLib {

	public final ResourceBundle getRouteSystemBundle() {
		String bundleFileName = "bundle/BDL000_ROUTE_SYS";
		boolean useCache = false;

		ResourceBundle bundle = BundleUtil.getBundle(bundleFileName, useCache);

		return bundle;
	}

	public synchronized DatabaseOracle getOracleDb() {

		ResourceBundle routeSysBundle = this.getRouteSystemBundle();
		String bundleName = routeSysBundle.getString("DB_BUNDLE_NAME");
		if ( false ) {
			this.debug("DB_BUNDLE_NAME: " + bundleName);
		}
		DatabaseOracle db = DatabaseOracle.getDatabaseOracleFromBundle(bundleName, true);

		return db;
	}

	private DbFactory() {
	}

	public static DbFactory getDbFactory() {
		return dbFactory;
	}

	private static final DbFactory dbFactory = new DbFactory();

}
